/**
 * @author szimek / https://github.com/szimek/
 */

GLE.WebGLRenderTarget = function ( width, height, options ) {

	this.width = width;
	this.height = height;

	options = options || {};

	this.wrapS = options.wrapS !== undefined ? options.wrapS : GLE.ClampToEdgeWrapping;
	this.wrapT = options.wrapT !== undefined ? options.wrapT : GLE.ClampToEdgeWrapping;

	this.magFilter = options.magFilter !== undefined ? options.magFilter : GLE.LinearFilter;
	this.minFilter = options.minFilter !== undefined ? options.minFilter : GLE.LinearMipMapLinearFilter;

	this.offset = new GLE.Vector2( 0, 0 );
	this.repeat = new GLE.Vector2( 1, 1 );

	this.format = options.format !== undefined ? options.format : GLE.RGBAFormat;
	this.type = options.type !== undefined ? options.type : GLE.UnsignedByteType;

	this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
	this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true;

	this.generateMipmaps = true;

};

GLE.WebGLRenderTarget.prototype.clone = function() {

	var tmp = new GLE.WebGLRenderTarget( this.width, this.height );

	tmp.wrapS = this.wrapS;
	tmp.wrapT = this.wrapT;

	tmp.magFilter = this.magFilter;
	tmp.minFilter = this.minFilter;

	tmp.offset.copy( this.offset );
	tmp.repeat.copy( this.repeat );

	tmp.format = this.format;
	tmp.type = this.type;

	tmp.depthBuffer = this.depthBuffer;
	tmp.stencilBuffer = this.stencilBuffer;

	return tmp;

};
